package com.mc.priority;

public class ArrayPriority {
	private int[] queue;
	private int count;
	public ArrayPriority(int m){
		queue = new int[m];
	}
	public void insert(int m){
		queue[count]=m;
		count++;
	}
	public int delMax(){
		int max = 0;
		for(int i=0;i<queue.length;i++){
			if(queue[max]<queue[i])max=i;
		}
		if(max!=count-1){
			int temp = queue[max];
			queue[max]=queue[count-1];
			queue[count-1]=temp;
		}
		count--;
		return queue[count];
	}
}
